//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//
//
#include "ChoicesFilter.h"

#include "Choices.h"
#include "Constraint.h"
#include "Log.h"
#include "Operand.h"

using namespace std;

namespace Green {

  bool ConstraintChoicesFilter::Usable(const Choice* choice) const
  {
    return mpConstraint->ContainsValue(choice->Value());
  }

  bool MultiRegisterChoicesFilter::Usable(const Choice* choice) const
  {
    ConstraintSet my_indices;
    mpOperand->GetRegisterIndices(choice->Value(), my_indices);
    // << "register index : " << dec << choice->Value() << " indices " << my_indices.ToSimpleString() << endl;
    return mpConstraint->ContainsConstraintSet(my_indices);
  }

}
